package com.ecloud.common.base.result;

/**
 * 请求响应状态枚举
 * 
 * @author LiuGangQiang Create in 2020/03/01
 */
public enum ResultStatus {
    /**
     * {@code 200 操作成功状态码}
     *
     * @author LiuGangQiang Create in 2020/03/01
     */
    OK(200, "api.code.ok"),

    /**
     * {@code 202 操作失败状态码}
     *
     * @author LiuGangQiang Create in 2020/03/01
     */
    FAIL(202, "api.code.fail"),

    /**
     * {@code 400 参数有误状态码}
     *
     * @author LiuGangQiang Create in 2020/03/01
     */
    BAD_REQUEST(400, "api.code.bad.request"),

    /**
     * {@code 401 未登录状态码}
     *
     * @author LiuGangQiang Create in 2020/03/01
     */
    UNAUTHORIZED(401, "api.code.unauthorized"),

    /**
     * {@code 403 无权限状态码}
     *
     * @author LiuGangQiang Create in 2020/03/01
     */
    FORBIDDEN(403, "api.code.forbidden"),
    /**
     * {@code 403 未被授权访问状态码(黑名单)}
     *
     * @author LiuGangQiang Create in 2021/06/20
     */
    AUTHORITY(403, "api.code.authority"),

    /**
     * {@code 404 空数据状态码}
     *
     * @author LiuGangQiang Create in 2020/03/01
     */
    DATA_NOT_FOUND(404, "api.code.data.not.found"),

    /**
     * {@code 404 方法未找到状态码}
     *
     * @author LiuGangQiang Create in 2020/04/20
     */
    METHOD_NOT_FOUND(404, "api.code.method.not.found"),

    /**
     * {@code 405 不被允许的方法状态码}
     *
     * @author LiuGangQiang Create in 2020/04/20
     */
    METHOD_NOT_ALLOWED(405, "api.code.method.not.allowed"),

    /**
     * {@code 409 数据冲突状态码}
     *
     * @author LiuGangQiang Create in 2020/03/01
     */
    CONFLICT(409, "api.code.conflict"),

    /**
     * {@code 429 请求限流状态码}
     *
     * @author LiuGangQiang Create in 2021/06/17
     */
    TOO_MANY_REQUESTS(429, "api.code.too.many.requests"),

    /**
     * {@code 429 热点参数限流状态码}
     *
     * @author LiuGangQiang Create in 2021/06/17
     */
    HOT_PARAM_FLOW(429, "api.code.hot.param.flow"),

    /**
     * {@code 500 系统异常状态码}
     *
     * @author LiuGangQiang Create in 2020/03/01
     */
    SYSTEM_ERROR(500, "api.code.system.error"),

    /**
     * {@code 501 未被控制的方法状态码}
     *
     * @author LiuGangQiang Create in 2020/03/01
     */
    UNIMPLEMENTED(501, "api.code.unimplemented"),

    /**
     * {@code 503 服务超载状态码}
     *
     * @author LiuGangQiang Create in 2021/06/17
     */
    SERVICE_UNAVAILABLE(503, "api.code.service.unavailable"),

    /**
     * {@code 503 服务降级状态码}
     *
     * @author LiuGangQiang Create in 2021/06/20
     */
    SERVICE_DEGRADE(503, "api.code.service.degrade"),
    /**
     * {@code 503 系统保护状态码}
     *
     * @author LiuGangQiang Create in 2021/06/20
     */
    SYSTEM_BLOCK(503, "api.code.system.block"),
    /**
     * {@code 503 Feign调用失败}
     *
     * @author LiuGangQiang Create in 2021/06/20
     */
    FEIGN_FALLBACK(503, "api.code.feign.fallback"),

    /**
     * {@code 504 服务超时状态码}
     *
     * @author LiuGangQiang Create in 2020/03/01
     */
    TIMEOUT(504, "api.code.timeout");

    /**
     * 状态码
     *
     * @author LiuGangQiang Create in 2020/03/01
     */
    private Integer value;
    /**
     * 提示消息
     *
     * @author LiuGangQiang Create in 2020/03/01
     */
    private String key;

    /**
     * @return the value
     */
    public Integer getValue() {
        return value;
    }

    /**
     * @return the key
     */
    public String getKey() {
        return key;
    }

    /**
     * 构造器
     *
     * @author LiuGangQiang Create in 2020/03/01
     * @param value 状态码
     * @param key   提示消息
     */
    ResultStatus(Integer value, String key) {
        this.value = value;
        this.key = key;
    }
}